<?php

namespace App\Http\Controllers;


use App\Models\MongoDBModel;
use App\Services\MongoDB\MongoDBServices;

class MongoDBController extends BaseController
{
    public function index()
    {
//        MongoDBModel::insert(array(
//            "title" => "MongoDB",
//            "description" => "database",
//            "likes" => 100,
//            "url" => "http://www.runoob.com/mongodb/",
//            "by"=> "菜鸟教程"
//        ));
//        MongoDBModel::where()->delete();
        //"62072961d5250000f60003e7"
//        $res = MongoDBModel::all()->toArray();
//        $res = MongoDBModel::find(["description"=>"database"])->toArray();
        $a = [
            "title" => "123",
            "data" => [
                "idd" => "323423",
                'asdf' => "wersdf",
                "data" => [
                    "sadf" => 123
                ]
            ],
            "dasdf" => "asdfsd"
        ];
        $data = MongoDBServices::getInstance()->findAllMo(["_id"=>"6209b3a64a08000079004303"]);
        dd($data);
    }
}
